<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>添加缴费</title>
<link rel="stylesheet" href="/scriptZIP/layui.min.css">
	<link rel="stylesheet" href="../css/common2.css">
	<link rel="stylesheet" href="../css/check_box.css">
	<link rel="stylesheet" href="../css/radio.css">
	<link rel="stylesheet" href="../css/layui.css">
	<style>
		.layui-row {
			margin-top: 50px;
		}

		.offer {
			margin-left: 50px;
		}

		.checkbox-inline {
			width: 25%;
		}
	</style>
</head>

<body>
	<div class="layui-row" id="vue-root">
		<div></div>
		<div class="layui-col-md6 layui-col-md-offset3">
			<div style="border: 2px solid #C9C9C9; width: 70%;margin-bottom: 35px; padding: 15px;">

				<div class="layui-form-item">
					<label class="layui-form-label" style="width: auto !important;">是否激活考勤卡收费功能</label>
					<div class="layui-input-block true" style="padding-top: 13px;line-height: 15px;">
						<input type="radio" name="paid" :value="true" title="是" v-model="item.paid">
						<span>是</span>
						<input type="radio" name="paid" :value="false" title="否" v-model="item.paid"
							style="margin-left: 20px;">
						<span>否</span>
					</div>
				</div>
				<div class="layui-form-item" v-if="item.paid">
					<label class="layui-form-label">请设置缴费金额</label>
					<div class="layui-input-block">
						<input autocomplete="off" class="layui-input introduction" style="min-width: 120px"
							v-model="item.fee">
					</div>
				</div>
				<div class="layui-form-item" v-if="item.paid">
					<label class="layui-form-label">请设置有效时长/天</label>
					<div class="layui-input-block">
						<input autocomplete="off" class="layui-input introduction" style="min-width: 120px"
							type="number" v-model="item.duration">

					</div>
				</div>
				<div class="layui-form-item">
					<div class="offer" @click="submit">立即提交</div>
				</div>
			</div>
		</div>
	</div>
	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>

	<script src="/scriptZIP/axios.min.js"></script>

	<script src="/js/common.js"></script>

	<script>
		var app = new Vue({
			el: '#vue-root',
			data: {
				item: {
					paid: false
				},
				schoolId: top_params().id,
			},
			created: function () {
				axios.get('/pc/school/' + this.schoolId).then(function (res) {
					var data = res.data;
					this.item.paid = data.payCard;
					this.item.fee = data.cardFee && data.cardFee / 100;
					this.item.duration = data.cardDuration;
				}.bind(this));
			},
			methods: {
				submit: function () {
					axios.post('/pc/school/card/' + this.schoolId, toFormParams(this.item)).then(function (res) {
						alert('修改成功');
						location.reload();
					});
				}
			}
		});

	</script>
</body>

</html>